<template>
  <div class="zqty_bodys" style="padding-top:20px;border:0px solid blue;" :style="{'height':(divAutoHeight-180)+'px','width':(divAutoWidth - 150)+'px'}" >
    <div  style="border:0px solid green;"  :style="{'height':(divAutoHeight-180)+'px','width':(divAutoWidth-170)+'px','margin-left':'20px'}" >

    <el-popover placement="bottom-start" trigger="click"  > 
      <el-form :inline="true" label-width="90px" :model="searchList" class="search-panle">
        <el-form-item label="卡号">
          <el-input v-model="searchList.cardId"  ></el-input>
        </el-form-item>
        <el-form-item label="身份证"><el-input v-model="searchList.idNo"  ></el-input></el-form-item>
        <el-form-item label="电话"><el-input v-model="searchList.phone"></el-input></el-form-item>
        <el-form-item label="姓名"><el-input v-model="searchList.providerName"></el-input></el-form-item>
        <el-form-item label="性别">
          <el-select v-model="searchList.sex" >
            <el-option value="" label="【空】"></el-option>
            <el-option :value="1" label="男"></el-option>
            <el-option :value="2" label="女"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="血型" ><el-select v-model="searchList.bloodType"><el-option value="" label="【空】"></el-option><el-option v-for="item in bloodTypeList" :key="item.code" :value="item.code" :label="item.name"></el-option></el-select></el-form-item>
        <el-form-item label="浆员状态" ><el-select v-model="searchList.providerState" ><el-option value="" label="【空】"></el-option><el-option v-for="item in codeData14" :key="item.code" :value="item.code" :label="item.name"></el-option></el-select></el-form-item>
        <el-form-item label="介绍人" ><el-input v-model="searchList.jsr" ></el-input></el-form-item>
        <el-form-item label="地址"><el-input v-model="searchList.address" ></el-input></el-form-item>
        <el-form-item label="身份证地址"><el-input v-model="searchList.idNoAddress" ></el-input></el-form-item>
        <el-form-item label="患者标签"><el-input v-model="searchList.refuseReason" ></el-input></el-form-item>
        <el-form-item label="创建时间" ><el-date-picker v-model="searchList.time"  type="daterange" range-separator="至" start-placeholder="开始时间" end-placeholder="结束时间" align="right"></el-date-picker></el-form-item>
      <el-button type="primary" @click="submitSearchData" >提交</el-button>
      </el-form>
      <el-button slot="reference" type="primary">查询</el-button>
    </el-popover>
    &nbsp;
    <!-- <el-button type="primary" @click="dialogShow('insert')">添加</el-button> -->
            <!-- 表格 -->
    <!-- <el-table :data="tableData" stripe border class="company-table" :height="tableHeight" style="width: 100%;" v-loading="loading">
            <el-table-column fixed type="index" label="*" sortable align="center" min-width="40"></el-table-column>
            <el-table-column prop="icon" label="头像"  min-width="28"><template slot-scope="scope">
                <img :src="'data:image/png;base64,'+ scope.row.icon" style="width: 25px;height:30px;margin-left:2px;"></template>
            </el-table-column>
            <el-table-column prop="name" label="姓名" sortable min-width="60"></el-table-column>
            <el-table-column prop="sex" label="性别" :formatter="formatSex" sortable min-width="40"></el-table-column>
            <el-table-column prop="age" label="年龄" sortable min-width="40"></el-table-column>
            <el-table-column prop="cardId" label="病案号" sortable min-width="55"></el-table-column>
            <el-table-column prop="phone" label="电话" sortable min-width="80"></el-table-column>
            <el-table-column prop="createDate" label="创建日期" sortable min-width="120"></el-table-column>
            <el-table-column prop="refuseReason" label="患者标签" sortable min-width="120"></el-table-column>
            <el-table-column fixed="right" label="操作" align="center" min-width="75">
                <template slot-scope="scope">
                    <el-button  @click="dialogShow('updata',scope.row)" type="text" size="small">编辑</el-button>
                </template>
            </el-table-column>
    </el-table>
    <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="pagination.currentPage" :page-sizes="[10, 15,20, 25,30,50, 100]" :page-size="pagination.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="pagination.total"></el-pagination>
   -->
        <div class="divTop" style="border:0px solid red;" :style="{'height':(divAutoHeight-220)+'px','overflow-y':'auto'}">
          <ul>
              <li v-for="item in tableData" class="showDataLi">
                <div class="showDataTop">
                  <div class="showDataTopLeft">
                    <img v-if="item.photo" :src="'data:image/png;base64,'+ item.photo" class="showDataImg" />
                  </div>
                  <div class="showDataTopCenter">
                    <div style="width:99%;height:30px;">
                        <div style="font-size:16px;font-weight:bolder;float:left;">
                            {{item.name}}
                        </div>
                        <div  style="font-size:13px;color:gray;float:left;margin-left:5px;margin-top:3px;">
                            {{item.sex === '1'? '男':'女'}}&nbsp;{{item.age}}岁
                        </div>
                    </div>
                    <div style="width:99%;height:70px;font-size:13px;color:gray;">
                      <div>病案号：{{item.cardId}}</div>
                      <div style="margin-top:3px;">电话：{{item.phone}}</div>
                      <div style="margin-top:3px;">患者标签：{{item.refuseReason}}</div>
                      <div style="margin-top:3px;">建档时间：{{item.createDate}}</div>
                    </div>
                  </div>
                  <div class="showDataTopRight">
                    <!-- <div    style="width:50px;height:18px;font-size:10px;color:white;background:#03BC89;margin:0px auto;margin-top:20px;border-radius: 10px;">
                      已建档
                    </div> -->
                    <!-- <div   v-if="item.recodeStatus != 1 "  style="width:50px;height:18px;font-size:10px;color:white;background:#03BC89;margin:0px auto;margin-top:20px;border-radius: 10px;">
                      待检验
                    </div> -->
                  </div>

                </div>
                <div class="showDataFoot" >
                  <div class="showDataFootLeft" @click="dialogShow('updata',item)">
                    编辑
                  </div>
                  <!-- <div class="showDataFootRight" @click="dialogShow('updata',item)">
                    详情
                  </div> -->
                  <!-- <div class="showDataFootLeft" @click="dialogShow('updata',item)">
                    打印小票
                  </div> -->
                </div>
              </li>        
          </ul>
        </div>
        <div class="divfooter">
           <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="pagination.currentPage" :page-sizes="[10, 15,20, 25,30,50, 100]" :page-size="pagination.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="pagination.total"></el-pagination>
        </div>
    <!-- 分页 -->
    <el-dialog :title="dialog1.title" :visible.sync="dialog1.isShow" width="99%" top="10px" :close-on-click-modal="false" class="dialog-form" v-dialogDrag>
      <div :style="{'height':(tableHeight-20)+'px','overflow-y':'auto'}">
      <el-tabs v-model="activeName" @tab-click="handleClick">
        <el-tab-pane label="基本档案信息" name="first">
          <h3 class="dialog-plate-title"><span>基本信息</span></h3>
          <el-row :gutter="20">
            <el-col :span="18">
              <el-form :inline="true" :model="dialogList" ref="dialogRefs" :rules="dialogRules" label-width="120px" >
                <el-form-item label="档案号" prop="cardId" v-if="dialog1.title!=='添加'" ><el-input v-model="dialogList.cardId" v-if="dialog1.title!=='添加'" disabled></el-input></el-form-item>
                <el-form-item label="姓名" prop="name"><el-input v-model="dialogList.name" :disabled="dialog1.title!=='添加'"></el-input></el-form-item>
                <el-form-item label="身份证号" prop="idNo"><el-input v-model="dialogList.idNo" :disabled="dialog1.title!=='添加'"></el-input></el-form-item>
                <el-form-item label="出生日期" prop="birthday"><el-date-picker v-model="dialogList.birthday" disabled type="date" placeholder="选择日期"></el-date-picker></el-form-item>
                <el-form-item label="年龄" prop="age"><el-input v-model="dialogList.age" disabled></el-input></el-form-item>
                <el-form-item label="性别" prop="sex"><el-select v-model="dialogList.sex" disabled class="select200"><el-option v-for="item in sexList" :key="item.code" :value="item.code" :label="item.name"></el-option></el-select></el-form-item>
                <el-form-item label="电话"><el-input v-model="dialogList.phone"></el-input></el-form-item>
                <el-form-item label="身份证地址"><el-input v-model="dialogList.idNoAddress" :disabled="dialog1.title!=='添加'"></el-input></el-form-item>
                <el-form-item label="地址"><el-input v-model="dialogList.address"></el-input></el-form-item>
                <el-form-item label="文化水平"><el-select v-model="dialogList.educationalLevel" class="select200"><el-option v-for="item in codeData8" :key="item.code" :value="item.code" :label="item.name"></el-option></el-select></el-form-item>
                <el-form-item label="婚姻状态"><el-select v-model="dialogList.maritalStatus" class="select200"><el-option v-for="item in codeData9" :key="item.code" :value="item.code" :label="item.name"></el-option></el-select></el-form-item>
               <!-- 
                  <el-form-item label="浆员类型" v-if="dialog1.title!=='添加'"><el-select v-model="dialogList.jylxId" class="select200"><el-option v-for="item in codeData10" :key="item.code" :value="item.code" :label="item.name"></el-option></el-select></el-form-item>
                <el-form-item label="血浆类型" v-if="dialog1.title!=='添加'"><el-select v-model="dialogList.plasmaType" disabled class="select200"><el-option v-for="item in codeData11" :key="item.code" :value="item.code" :label="item.name"></el-option></el-select></el-form-item>
                <el-form-item label="血型" v-if="dialog1.title!=='添加'"><el-input v-model="dialogList.bloodTypeName" disabled></el-input></el-form-item>
                <el-form-item label="血管等级" v-if="dialog1.title!=='添加'"><el-select v-model="dialogList.veinGrade" class="select200"><el-option v-for="item in codeData13" :key="item.code" :value="item.code" :label="item.name"></el-option></el-select></el-form-item>
                <el-form-item label="浆员状态" v-if="dialog1.title!=='添加'"><el-select v-model="dialogList.providerState" disabled class="select200"><el-option v-for="item in codeData14" :key="item.code" :value="item.code" :label="item.name"></el-option></el-select></el-form-item>
                <el-form-item v-if="dialogList.providerState!='0'" label="拒绝原因"><el-input v-model="dialogList.refuseReason" disabled></el-input></el-form-item>
                <el-form-item v-if="dialogList.providerState!='0'" label="拒绝时间"><el-date-picker v-model="dialogList.refuseDate" disabled type="date" placeholder="选择日期"></el-date-picker></el-form-item>
               
                <el-form-item label="介绍人" prop="introducer"><el-input v-model="dialogList.introducer"></el-input></el-form-item>
                <el-form-item label="介绍人添加时间"><el-input v-model="dialogList.addIntroducerTime" disabled></el-input></el-form-item>
               
                -->
                <el-form-item label="建档日期"><el-input v-model="dialogList.createDate" disabled></el-input></el-form-item>
                <el-form-item label="建档护士"><el-input v-model="dialogList.createNurseName" disabled></el-input></el-form-item>
              </el-form>
            </el-col>
            <el-col :span="6">
              <div class="photoImg">
                  <img v-if="dialogList.photo" :src="'data:image/png;base64,'+ dialogList.photo" class="avatar" />
              </div>
            </el-col>
          </el-row>
          <h3 class="dialog-plate-title"><span>证件信息</span></h3>
          <el-row :gutter="20" style="margin-right: 0;" >
            <el-col :span="2">&nbsp;</el-col>
            <el-col :span="9">
              <el-upload class="identityCard"
                :action="idCardPhotoUrl1"
                :show-file-list="false"
                :on-success="handleAvatarSuccess"
                :before-upload="beforeAvatarUpload">
                <img v-if="dialogList.idCardPhoto" :src="'data:image/png;base64,'+ dialogList.idCardPhoto" class="avatar" />
                <i v-else class="el-icon-plus avatar-uploader-icon">身份证正面</i>
              </el-upload>
            </el-col>
            <el-col :span="2">&nbsp;</el-col>
            <el-col :span="9">
              <el-upload class="identityCard"
                :action="idCardPhotoUrl2"
                :show-file-list="false"
                :before-upload="beforeAvatarUpload"
                :on-success="handleAvatarSuccess1">
                <img v-if="dialogList.idCardPhoto1" :src="'data:image/png;base64,'+ dialogList.idCardPhoto1" class="avatar" />
                <i v-else class="el-icon-plus avatar-uploader-icon">身份证反面</i>
              </el-upload>
            </el-col>
            <el-col :span="2">&nbsp;</el-col>
        </el-row>
        <el-form :inline="true" :model="dialogList" label-width="100px" class="demo-ruleForm">
            <el-form-item label="身份证有效期"><el-date-picker v-model="dialogList.idCardValidDate" disabled type="date" placeholder="选择日期"></el-date-picker></el-form-item>
            <el-form-item label="扫描时间"> <el-date-picker v-model="dialogList.idCardScanDate"  type="datetime" placeholder="选择日期"></el-date-picker></el-form-item>
            <el-form-item label="证照记录人"><el-input v-model="dialogList.certificateRegisterName" disabled style="width: 190px;"></el-input></el-form-item>
        </el-form>
 
        <br/>
        <div v-if="dialog1.title!=='添加'">
          <!-- 血液信息 -->
          <h3 class="dialog-plate-title"><span>血管信息</span></h3>
                    <el-row :gutter="20">
            <el-col :span="18">
              <el-form :inline="true" :model="dialogList" ref="dialogRefs" :rules="dialogRules" label-width="120px" >
    
                <el-form-item label="血型" v-if="dialog1.title!=='添加'"><el-input v-model="dialogList.bloodTypeName" disabled></el-input></el-form-item>
                <el-form-item label="血浆类型" v-if="dialog1.title!=='添加'"><el-select v-model="dialogList.plasmaType" disabled class="select200"><el-option v-for="item in codeData11" :key="item.code" :value="item.code" :label="item.name"></el-option></el-select></el-form-item>
                <el-form-item label="血管等级" v-if="dialog1.title!=='添加'"><el-select v-model="dialogList.veinGrade" disabled class="select200"><el-option v-for="item in codeData13" :key="item.code" :value="item.code" :label="item.name"></el-option></el-select></el-form-item>
                <el-form-item label="病员类型" v-if="dialog1.title!=='添加'"><el-select v-model="dialogList.jylxId" disabled  class="select200"><el-option v-for="item in codeData10" :key="item.code" :value="item.code" :label="item.name"></el-option></el-select></el-form-item>
               
              </el-form>
            </el-col>
          </el-row>

         <div>
          <el-button type="primary" @click="submitDialog">提交</el-button>
        </div>
            <!-- 
          <el-table :data="chemicalList" stripe border class="company-table" height="150px" style="width: 100%;">
              <el-table-column fixed type="index" label="*" sortable align="center" min-width="40"></el-table-column>
              <el-table-column prop="recodeEndTime" label="采样时间" sortable min-width="200"></el-table-column>
              <el-table-column prop="inspectionRecodePersonName" label="化检记录人" sortable min-width="150"></el-table-column>
              <el-table-column prop="inspectionResultName" label="化检结果" sortable min-width="150"></el-table-column>
              <el-table-column fixed="right" label="操作" align="center" min-width="75">
                  <template slot-scope="scope">
                      <el-button  @click="dialog2Show('chemical',scope.row)" type="text" size="small">查看</el-button>
                  </template>
              </el-table-column>
          </el-table> -->

          <!-- 指纹记录 -->
          <!-- <h3 class="dialog-plate-title"><span>指纹记录</span></h3>
          <el-table :data="fingerPrintList" stripe border class="company-table" height="200px" style="width: 100%;" >
              <el-table-column fixed type="index" label="*" sortable align="center" min-width="40"></el-table-column>
              <el-table-column prop="codeName" label="已录指纹" sortable min-width="200"></el-table-column>
          </el-table> -->
        </div>
        </el-tab-pane>
<!-- 
        <el-tab-pane label="本院病例" name="currentBl" v-if="dialog1.title!=='添加'">
          <el-button type="primary" @click="insertUpdateXp('insert')">新增</el-button>
          <el-table :data="tableChestData" stripe border class="company-table">
              <el-table-column fixed type="index" label="*" sortable align="center" min-width="40"></el-table-column>
              <el-table-column prop="createDate" label="就诊日期" sortable min-width="200"></el-table-column>
              <el-table-column prop="remark" label="诊断结果" sortable min-width="200"></el-table-column>
              <el-table-column prop="doctor" label="诊断医师" sortable min-width="200"></el-table-column>
              <el-table-column fixed="right" label="操作" align="center" min-width="75">
                  <template slot-scope="scope">
                      <el-button  @click="insertUpdateXp('update',scope.row)" type="text" size="small">详情</el-button>
                      <el-button  @click="insertUpdateXp('update',scope.row)" type="text" size="small">打印</el-button>
                  </template>
                 
              </el-table-column>
          </el-table>
        </el-tab-pane>
          -->
         <el-tab-pane label="历史病例" name="otherBl">
          <el-button type="primary" @click="insertHOtherCheck('5')">新增</el-button>
          <el-table :data="tableChestData" stripe border class="company-table">
              <el-table-column fixed type="index" label="*" sortable align="center" min-width="40"></el-table-column>
              <el-table-column prop="checkDate" label="就诊日期" sortable min-width="200">
                <template slot-scope="scope">
                  {{timestampToTime(scope.row.checkDate==null?new Date():scope.row.checkDate,'yyyy-mm-dd')}}
                </template>
              </el-table-column>
              <el-table-column prop="checkRemark" label="诊断结果" sortable min-width="200"></el-table-column>
              <el-table-column prop="checkUnit" label="诊断地点" sortable min-width="200"></el-table-column>
              <el-table-column fixed="right" label="操作" align="center" min-width="75">
                  <template slot-scope="scope">
                      <el-button  @click="insertUpdateCheck('history',scope.row)" type="text" size="small">详情</el-button>
                  </template>                 
              </el-table-column>
          </el-table>
        </el-tab-pane>

        <el-tab-pane label="血液检测" name="11">
          <h3 class="dialog-plate-title"><span>结果上传</span></h3>
          <el-button type="primary" @click="insertHOtherCheck('1')">新增</el-button>
          <el-table :data="tableDataForBlood" stripe border class="company-table">
              <el-table-column fixed type="index" label="*" sortable align="center" min-width="40"></el-table-column>
              <el-table-column prop="wbc" label="白细胞计数" sortable min-width="80"></el-table-column>
              <el-table-column prop="platelet" label="血小板" sortable min-width="80"></el-table-column>
              <el-table-column prop="hct" label="HCT" sortable min-width="80"></el-table-column>
              <el-table-column prop="triglyceride" label="甘油三脂" sortable min-width="80"></el-table-column>
              <el-table-column prop="lp" label="LP" sortable min-width="80"></el-table-column>
              <el-table-column prop="sod" label="SOD" sortable min-width="80"></el-table-column>
              <el-table-column prop="mda" label="MDA" sortable min-width="80"></el-table-column>
              <el-table-column prop="ldl" label="低密脂蛋白" sortable min-width="100"></el-table-column>
              <el-table-column prop="cholesterol" label="胆固醇" sortable min-width="80"></el-table-column>
              <el-table-column prop="checkDate" label="检测日期" sortable min-width="100">
                <template slot-scope="scope">
                  {{timestampToTime(scope.row.checkDate,'yyyy-mm-dd')}}
                </template>
              </el-table-column>
              <el-table-column prop="uploadDate" label="上传日期" sortable min-width="130">
                <template slot-scope="scope">
                  {{timestampToTime(scope.row.uploadDate,'yyyy-mm-dd hh:mm')}}
                </template>
              </el-table-column>
              <el-table-column prop="uploadUserName" label="上传人" sortable min-width="100"></el-table-column>
              <el-table-column fixed="right" label="操作" align="center" min-width="75">
                  <template slot-scope="scope">
                      <el-button  @click="insertUpdateCheck('blood',scope.row)" type="text" size="small">编辑</el-button>
                  </template>         
              </el-table-column>
          </el-table>
        </el-tab-pane>

        <el-tab-pane label="CT检测" name="12">
          <h3 class="dialog-plate-title"><span>结果上传</span></h3>
          <el-button type="primary" @click="insertHOtherCheck('2')">新增</el-button>
          <el-table :data="tableDataForCt" stripe border class="company-table">
              <el-table-column fixed type="index" label="*" sortable align="center" min-width="40"></el-table-column>
              <el-table-column prop="checkDate" label="检测日期" sortable min-width="100">
                <template slot-scope="scope">
                  {{timestampToTime(scope.row.checkDate,'yyyy-mm-dd')}}
                </template>
              </el-table-column>
              <el-table-column prop="uploadDate" label="上传日期" sortable min-width="130">
                <template slot-scope="scope">
                  {{timestampToTime(scope.row.uploadDate,'yyyy-mm-dd hh:mm')}}
                </template>
              </el-table-column>
              <el-table-column prop="uploadUserName" label="上传人" sortable min-width="200"></el-table-column>
              <el-table-column fixed="right" label="操作" align="center" min-width="75">
                  <template slot-scope="scope">
                      <el-button  @click="insertUpdateCheck('ct',scope.row)" type="text" size="small">详情</el-button>
                  </template>         
              </el-table-column>
          </el-table>
        </el-tab-pane>
        <el-tab-pane label="超声检测" name="13" >
          <h3 class="dialog-plate-title"><span>结果上传</span></h3>
          <el-button type="primary" @click="insertHOtherCheck('3')">新增</el-button>
          <el-table :data="tableDataForMt" stripe border class="company-table">
              <el-table-column fixed type="index" label="*" sortable align="center" min-width="40"></el-table-column>
              <el-table-column prop="checkDate" label="检测日期" sortable min-width="100">
                <template slot-scope="scope">
                  {{timestampToTime(scope.row.checkDate,'yyyy-mm-dd')}}
                </template>
              </el-table-column>
              <el-table-column prop="uploadDate" label="上传日期" sortable min-width="130">
                <template slot-scope="scope">
                  {{timestampToTime(scope.row.uploadDate,'yyyy-mm-dd hh:mm')}}
                </template>
              </el-table-column>
              <el-table-column prop="uploadUserName" label="上传人" sortable min-width="200"></el-table-column>
              <el-table-column fixed="right" label="操作" align="center" min-width="75">
                  <template slot-scope="scope">
                      <el-button  @click="insertUpdateCheck('mt',scope.row)" type="text" size="small">详情</el-button>
                  </template>         
              </el-table-column>
          </el-table>
        </el-tab-pane>
        <el-tab-pane label="其它" name="14" v-if="dialog1.title!=='添加'">
          <h3 class="dialog-plate-title"><span>结果上传</span></h3>
          <el-button type="primary" @click="insertHOtherCheck('4')">新增</el-button>
          <el-table :data="tableDataForOts" stripe border class="company-table">
              <el-table-column fixed type="index" label="*" sortable align="center" min-width="40"></el-table-column>
              <el-table-column prop="checkDate" label="检测日期" sortable min-width="100">
                <template slot-scope="scope">
                  {{timestampToTime(scope.row.checkDate,'yyyy-mm-dd')}}
                </template>
              </el-table-column>
              <el-table-column prop="uploadDate" label="上传日期" sortable min-width="130">
                <template slot-scope="scope">
                  {{timestampToTime(scope.row.uploadDate,'yyyy-mm-dd hh:mm')}}
                </template>
              </el-table-column>
              <el-table-column prop="uploadUserName" label="上传人" sortable min-width="200"></el-table-column>
              <el-table-column fixed="right" label="操作" align="center" min-width="75">
                  <template slot-scope="scope">
                      <el-button  @click="insertUpdateCheck('ots',scope.row)" type="text" size="small">详情</el-button>
                  </template>         
              </el-table-column>
          </el-table>
        </el-tab-pane>
      </el-tabs>
      </div>
      <div slot="footer">
      </div>
    </el-dialog>
    <el-dialog :title="dialog2.title" :visible.sync="dialog2.isShow" width="800px" top="60px" center :close-on-clcick-modal="false" class="dialog-form">
      <div :style="{'height':(tableHeight-90)+'px','overflow-y':'auto'}">
        <pulp-baseinfo :pulpInfo='chemicalInfo' v-if='dialog2.title==="化检详细信息"' :baseinfoDisabled='true'></pulp-baseinfo>
      </div>
    </el-dialog>
    <el-dialog :title="dialogForUp.title" :visible.sync="dialogForUp.isShow" width="100%" :height="divAutoHeight+'px'" top="60px" center :close-on-clcick-modal="false" class="dialog-form">
      <div :style="{'height':(tableHeight-90)+'px','overflow-y':'auto'}">
        <el-form :inline="true" ref='checkForm' :model="dialogForUp" label-width="100px" class="demo-ruleForm" :rules="chestRules">
          <span v-if="dialogForUp.type==='history'">
          <el-form-item label="检查单位" prop="checkUnit" ><el-input v-model="dialogForUp.checkUnit"></el-input></el-form-item>
          <el-form-item label="诊断结果" prop="checkRemark" ><el-input v-model="dialogForUp.checkRemark"></el-input></el-form-item>
          <el-form-item label="就诊日期" prop="checkDate" ><el-date-picker type="date" v-model="dialogForUp.checkDate" placeholder="选择日期"></el-date-picker></el-form-item>
          <el-form-item label="病例记录人"><el-input v-model="dialogForUp.uploadUserName"></el-input></el-form-item>
          </span>  
          <span v-if="dialogForUp.type==='blood'">
          <el-form-item label="白细胞计数" prop="wbc" ><el-input v-model="dialogForUp.wbc"></el-input></el-form-item>
          <el-form-item label="血小板" prop="platelet" ><el-input v-model="dialogForUp.platelet"></el-input></el-form-item>
          <el-form-item label="HCT" prop="hct" ><el-input v-model="dialogForUp.hct"></el-input></el-form-item>
          <el-form-item label="甘油三脂" prop="triglyceride" ><el-input v-model="dialogForUp.triglyceride"></el-input></el-form-item>
          <el-form-item label="LP" prop="lp" ><el-input v-model="dialogForUp.lp"></el-input></el-form-item>
          <el-form-item label="SOD" prop="sod" ><el-input v-model="dialogForUp.sod"></el-input></el-form-item>
          <el-form-item label="MDA" prop="mda" ><el-input v-model="dialogForUp.mda"></el-input></el-form-item>
          <el-form-item label="低密脂蛋白" prop="ldl" ><el-input v-model="dialogForUp.ldl"></el-input></el-form-item>
          <el-form-item label="胆固醇" prop="cholesterol" ><el-input v-model="dialogForUp.cholesterol"></el-input></el-form-item>
          <el-form-item label="检测日期" prop="checkDate" ><el-date-picker type="date" v-model="dialogForUp.checkDate" placeholder="选择日期"></el-date-picker></el-form-item>
          <el-form-item label="上传人"><el-input v-model="dialogForUp.uploadUserName" disabled></el-input></el-form-item>
          </span>
          <span v-if="dialogForUp.type==='ct'">
          <el-form-item label="检测日期" prop="checkDate" ><el-date-picker type="date" v-model="dialogForUp.checkDate" placeholder="选择日期"></el-date-picker></el-form-item>
          <el-form-item label="上传人"><el-input v-model="dialogForUp.uploadUserName" disabled></el-input></el-form-item>
          </span>
          <span v-if="dialogForUp.type==='mt'">
          <el-form-item label="检测日期" prop="checkDate" ><el-date-picker type="date" v-model="dialogForUp.checkDate" placeholder="选择日期"></el-date-picker></el-form-item>
          <el-form-item label="上传人"><el-input v-model="dialogForUp.uploadUserName" disabled></el-input></el-form-item>
          </span>
          <span v-if="dialogForUp.type==='ots'">
           <el-form-item label="检测日期" prop="checkDate" ><el-date-picker type="date" v-model="dialogForUp.checkDate" placeholder="选择日期"></el-date-picker></el-form-item>
          <el-form-item label="上传人"><el-input v-model="dialogForUp.uploadUserName" disabled></el-input></el-form-item>
          </span>
          <el-form-item label="附件上传" prop="photo" style="display:block;">
            <template slot="label">病例</template>
            <div :span="19" class="avatar">
              <el-upload
                    class="upload-demo"
                    ref="uploadImageBox"
                    :action="dialogForUp.actionUrl"
                    :on-success="updateImageSize"
                    list-type="picture">
                    <el-button size="small" type="primary">点击上传</el-button>
                    <div slot="tip" class="el-upload__tip">只能上传jpg/png文件，且不超过500kb</div>
              </el-upload>
                   <div v-for="item in fileList" style="width:1060px;height:1520px;">
                     <img :src="item.url" style="width:1060px;height:1520px;">
                   </div>
            </div>
          </el-form-item>
        </el-form>       
      </div>
      <div slot="footer" style="text-align: right;">
          <el-button type="primary" @click="submitChestDialog">提交</el-button>
      </div> 
    </el-dialog>
    <!-- 病例信息 -->
    <el-dialog :title="dialog3.title" :visible.sync="dialog3.isShow" width="70%" top="70px" :close-on-clcick-modal="false" class="dialog-form">
      <div :style="{'height':(tableHeight-90)+'px','overflow-y':'auto'}">
        <el-form :inline="true" ref='chestForm' :model="dialogChestList" label-width="100px" class="demo-ruleForm" :rules="chestRules">
          <el-form-item label="检查单位" prop="hospital" ><el-input v-model="dialogChestList.hospital"></el-input></el-form-item>
          <el-form-item label="检查医生" prop="doctor" ><el-input v-model="dialogChestList.doctor"></el-input></el-form-item>
          <el-form-item label="诊断结果" prop="remark" ><el-input v-model="dialogChestList.remark"></el-input></el-form-item>
          <el-form-item label="就诊日期" prop="validDate" ><el-date-picker type="date" v-model="dialogChestList.validDate" placeholder="选择日期"></el-date-picker></el-form-item>
          <el-form-item label="病例记录人"><el-input v-model="dialogChestList.crearorName"></el-input></el-form-item>
          <el-form-item label="纸质病例" prop="photo" style="display:block;">
            <template slot="label">纸质病例</template>
            <div :span="19" class="avatar">
              <el-upload class="xpPhoto"  
                :action="idCardPhotoUrl"
                :show-file-list="false" 
                :on-success="handleAvatarChestSuccess"
                :before-upload="beforeAvatarUpload">
                <img v-if="dialogChestList.photo" :src="'data:image/png;base64,'+ dialogChestList.photo" class="avatar" />
                <i v-else class="el-icon-plus avatar-uploader-icon"></i>
              </el-upload>
              </div>
          </el-form-item>
        </el-form>
        
      </div>
      <div slot="footer" style="text-align: right;">
          <el-button type="primary" @click="submitChestDialog">提交</el-button>
      </div>
    </el-dialog>
  </div>
    </div>
</template>
<script>
import api from 'plugins/axios/api.js';
import regx from 'plugins/regx.js';
import pulpBaseinfo from 'views/operationManage/components/pulpBaseInfo.vue';
export default {
  components:{
    pulpBaseinfo,
  },
  data(){
    return {
      // fileList: [{name: 'food.jpeg', url: ''}, {name: 'food2.jpeg', url: 'https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100'}],
      fileList: [],
      bloodTypeList:[],/**血型列表*/
      sexList:[],/**性别列表 */
      codeData8:[],/**文化水平列表*/
      codeData9:[],/** 婚姻状态列表*/
      codeData10:[],/** 浆员类型列表*/
      codeData11:[],/**血浆类型列表 */
      codeData13:[],/**血管类型列表 */
      codeData14:[],/**浆员状态 */
      tableData:[],/**表格列表 */
      chemicalList:[],/**浆员化检信息列表 */
      fingerPrintList:[],/**浆员化检指纹列表 */
      tableChestData :[],/**病例列表 */
      tableDataForBlood:[],
      tableDataForCt:[],
      tableDataForMt:[],
      tableDataForOts:[],
      loading:false,
      /**搜索参数 */
      searchList:{
        cardId:'',
        providerName:'',
        idNo:'',
        sex:'',
        idNoAddress:'',
        address:'',
        phone:'',
        bloodType:'',
        createStartTime:'',
        createEndTime:'',
        providerState:'',
        jsr:'',
        time:'',
      },
      /**分页参数 */
      pagination:{
        currentPage:1,
        pageSize:10,
        total:0
      },
      dialogForUp:{
        title:'',
        isShow:false,
        type:'',
        actionUrl:'/uploadCheckImage/{id}/{type}',
        id:null,                           //记录id
        //血液检查
        bloodId:null,                      //记录Id
        wbc: null,                         //白细胞计数
        platelet:null,                     //血小板
        hct:null,                          //HCT
        filePath:null,                     //图片路径（数据库字段）
        images:[],                         //图片路径（视图层路径）
        checkDate: new Date(),             //检查日期 
        uploadDate: new Date(),            //上传日期 
        uploadUser: null,                  //上传人ID 
        uploadUserName:localStorage.getItem('ms_username'), //上传人姓名 
        providerIdCard: "513902199201146037", //对应的用户身份证
        triglyceride: null,                //甘油三脂 
        lp: null,                          //LP
        sod: 1,                            //SOD
        mda: null,                         //MDA 
        ldl: null,                         //低密脂蛋白 
        cholesterol: null,                 //胆固醇 
        //血液循环字段完毕
        //历史病例
        historyId:null,                    //记录Id
        checkRemark:null,                  //检测结果
        checkUnit:null,                    //检测单位
        ctId:null,
        mtId:null,
        otsId:null,
      },
      dialog1:{
        title:'',
        isShow:false
      },
      dialog2:{
        title:'',
        isShow:false
      },
      dialog3:{
        title:'',
        isShow:false
      }, 
      dialog4:{
        title:'',
        isShow:false
      },
      chemicalInfo:{},
      activeName:'first',
      dialogRules:{
        name: [
          { required: true, message: '请输入姓名', trigger: 'blur' },
          ],
        idNo:[
          { required: true, message: '请输入身份证号', trigger: 'blur' },
          { validator:regx.checkedID, trigger: 'blur' }
        ]
      },
      chestRules:{
        result:[ {required: true, message: '请选择是否合格', trigger: 'blur'}],
        hospital:[{required: true, message: '请输入检查单位', trigger: 'blur'}],
        doctor:[{required: true, message: '请输入检查医生', trigger: 'blur'}],
        remark:[{required: true, message: '请输入检查备注', trigger: 'blur'}],
        validDate:[{required: true, message: '请输入有效日期', trigger: 'blur'}],
        photo:[{required: true, message: '请上传病例照片', trigger: 'blur'}],
      },
      bodycheckRules:{
        result:[ {required: true, message: '请选择是否合格', trigger: 'blur'}],
        hospital:[{required: true, message: '请输入检查单位', trigger: 'blur'}],
        doctor:[{required: true, message: '请输入检查医生', trigger: 'blur'}],
        remark:[{required: true, message: '请输入检查备注', trigger: 'blur'}],
        validDate:[{required: true, message: '请输入有效日期', trigger: 'blur'}],
        photo:[{required: true, message: '请上传病例照片', trigger: 'blur'}],       
      },
      dialogHeight2Table:[],
      dialogChestList:{},//病例
      dialogBodyCheckList:{},//体检
      idCardPhotoNo:null,  
      idCardPhotoType:null,
      idCardPhotoUrl:api.idImgUpload1(),
      idCardPhotoUrl1:'',
      idCardPhotoUrl2:'',
      dialogList:{
        certificateRegisterName:localStorage.getItem('ms_username'),
      },
      imgurlpath:'',
      username:localStorage.getItem('ms_username'),
      mainActiveName:'0',
    }
  },
  watch:{
    "dialogList.idNo":{/**监听身份证号码的输入 */
      handler(newIdNo, oldIdNo){
        let self = this;
      if(!regx.regexString.regxID.test(newIdNo)){
        self.dialogList.birthday = "";
        self.dialogList.age = "";
        self.dialogList.sex = "";
        return;
      }
      //获取出身日期
      self.dialogList.birthday = newIdNo.substring(6, 10) + "-" + newIdNo.substring(10, 12) + "-" + newIdNo.substring(12, 14);
        //获取年龄
      let myDate = new Date();
      let month = myDate.getMonth() + 1;
      let day = myDate.getDate();
      let age = myDate.getFullYear() - newIdNo.substring(6, 10) - 1;
      if (newIdNo.substring(10, 12) < month || newIdNo.substring(10, 12) == month && newIdNo.substring(12, 14) <= day) {
          age++;
      }
      self.dialogList.age = age;
      //获取性别
        if (parseInt(newIdNo.substr(16, 1)) % 2 == 1) {
          //男
          self.dialogList.sex='1';
        } else {
          //女
          self.dialogList.sex = "2";
        }
      }
    }
  },
  computed:{
    tableHeight() {
      return this.$store.state.clientHeight - 184;
    },
    divAutoHeight() {
      return this.$store.state.clientHeight;
    },
    divAutoWidth() {
      return this.$store.state.clientWidth - 100;
    },
    autoHeight() {
      return this.$store.state.clientHeight / 2 - 55;
    },
    autoWidth() {
      return this.$store.state.clientWidth - 55;
    }
  },
  created(){
    
    let self = this;
    self.getData();
    /*血型 */
    api.getCodeData(12).then(res=>{
        self.bloodTypeList=res.content;
    });
    /**浆员状态 */
    api.getCodeData(14).then(res=>{
        self.codeData14=res.content;
    });
    /**性别 */
    api.getCodeData(7).then(res=>{
      self.sexList=res.content;
    })
    api.getCodeData(8).then(res=>{
      self.codeData8= res.content;
    })
    api.getCodeData(9).then(res=>{
      self.codeData9 = res.content;
    })
    api.getCodeData(10).then(res=>{
      self.codeData10 = res.content;
    })
    api.getCodeData(11).then(res=>{
      self.codeData11= res.content;
    })
    api.getCodeData(13).then(res=>{
      self.codeData13 = res.content;
    })
  },
  mounted(){
  },
  methods:{
    updateImageSize(response, file, fileList){
      let self = this;
      console.log(file)
      let imageObj={name:file.name,url:'data:image/png;base64,'+response.content};
      self.fileList.push(imageObj);
    },
    insertHOtherCheck(type){
      let self = this;
      api.insertHOtherCheck(type,self.dialogForUp.idCard).then(res=>{
        self.$message("新增成功!");
        self.queryOtherChecks(Number(type));
      });
    },
    queryOtherChecks(type){
      let self = this;
      api.queryOtherChecks(type,self.dialogForUp.idCard).then(res=>{
        switch (type) {
          case 1: self.tableDataForBlood =res.content;break;
          case 2:self.tableDataForCt =res.content; break;
          case 3:self.tableDataForMt =res.content; break;
          case 4:self.tableDataForOts =res.content; break;
          case 5:self.tableChestData =res.content; break;
          default:
            break;
        }
      });
    },
    syschRecodeStatus(ins){
      let self = this;
      switch (ins.name) {
        case '1':
          // self.searchList.recodeStatus=1;
          self.getData();
          break;
        case '0':
          // self.searchList.recodeStatus=0;
          self.getData();
          break;   
        default:
          break;
      }
    },
    alertMsg(s){
      alert(s);
    },
    getData(){/**建档记录查询 */
      let self = this;
      self.loading=true;
      let data={
        currentPage:self.pagination.currentPage,
        pageSize:self.pagination.pageSize,
        cardId:self.searchList.cardId,
        providerName:self.searchList.providerName,
        idNo:self.searchList.idNo,
        sex:self.searchList.sex,
        idNoAddress:self.searchList.idNoAddress,
        address:self.searchList.address,
        phone:self.searchList.phone,
        bloodType:self.searchList.bloodType,
        createStartTime:self.searchList.time ? self.timestampToTime(self.searchList.time[0],'yy-mm-dd') : "",
        createEndTime:self.searchList.time ? self.timestampToTime(self.searchList.time[1],'yy-mm-dd') : "",
        providerState:self.searchList.providerState,
        jsr:self.searchList.jsr,
      };
      api.providerInfo(data).then(res=>{
        self.loading=false;
        self.pagination.total = res.content.total;
        self.tableData = res.content.records;
        //遍历一下根据出身日期算出age
        self.tableData.forEach(item=>{
           let  newIdNo=item.idNo;
            item.birthday = newIdNo.substring(6, 10) + "-" + newIdNo.substring(10, 12) + "-" + newIdNo.substring(12, 14);
        //获取年龄
            let myDate = new Date();
            let month = myDate.getMonth() + 1;
            let day = myDate.getDate();
            let age = myDate.getFullYear() - newIdNo.substring(6, 10) - 1;
            if (newIdNo.substring(10, 12) < month || newIdNo.substring(10, 12) == month && newIdNo.substring(12, 14) <= day) {
                age++;
            }
            item.age = age;
        })

      },error=>{
        self.loading=false;
      })
    },
    submitSearchData(){/**点击搜索 */
      this.pagination.currentPage=1;
      this.getData();
    },
    handleSizeChange(size){/**改变分页数据条数 */
      this.pagination.currentPage=1;
      this.pagination.pageSize=size;
      this.getData();
    },
    handleCurrentChange(current){/**改变分页页数*/
      this.pagination.currentPage=current;
      this.getData();
    },
    insertUpdateXp(type,row){
      let self = this;
      type==='insert'?'':row.result=String(row.result);
      self.dialogChestList = type==="insert" ? {
        crearor: '',
        crearorName: '',
        createDate: '',
        doctor: '',
        hospital: '',
        photo: '',
        providerNo: '',
        remark: '',
        result: '',
        validDate: ''
      } : row;
      self.dialog3.title=type==="insert"?'新增':'编辑';
      self.dialog3.isShow = true;
     
    },
    dialogShow(type,row){
      let self = this;
      self.dialog1.title = type==='insert'?'添加':'编辑';
      self.dialog1.isShow=true;
      self.activeName = 'first';
      self.idCardPhotoNo = row.idNo; 
      self.idCardPhotoUrl1= api.idImgUpload(row.idNo,1);
      self.idCardPhotoUrl2 = api.idImgUpload(row.idNo,2);
      self.dialogForUp.idCard = row.idNo;
      if(type==='insert'){
         self.dialogList ={
          name:'',
          idNo:'',
          birthday:'',
          age:'',
          sex:'',
          idNoAddress:'',
          address:'',
          phone:'',
          educationalLevel:'',
          maritalStatus:'',
          introducer:'',
          idCardPhoto:'',
          idCardPhoto1:'',
          idCardValidDate:'',
          certificateRegisterName:localStorage.getItem('ms_username')
         }
      }else{
        self.dialogList =row;
        self.dialogList.jylxId = row.jylxId===null?'':String(row.jylxId);
        self.dialogList.maritalStatus= row.maritalStatus===null?'':String(row.maritalStatus);
        self.dialogList.educationalLevel= row.educationalLevel===null?'':String(row.educationalLevel);
        self.dialogList.veinGrade= row.veinGrade===null?'':String(row.veinGrade);
        self.dialogList.plasmaType= row.plasmaType===null?'':String(row.plasmaType);
        self.dialogList.certificateRegisterName = localStorage.getItem('ms_username');
        self.getchemicalList();
        self.getFingerPrintList();
      }
    },
    handleClick(tab, event){
      /**切换tab */ 
      if(tab.name==="currentBl"){
        this.getXpList();
      }
      if(tab.name==="otherBl"){
        this.queryOtherChecks(5);
      } 
      if(tab.name==="11"){
        this.queryOtherChecks(1);
      } 
      if(tab.name==="12"){
        this.queryOtherChecks(2);
      }  
      if(tab.name==="13"){
        this.queryOtherChecks(3);
      }  
      if(tab.name==="14"){
        this.queryOtherChecks(4);
      }
    },
    getXpList(){
      let self = this;
      /**获取病例信息列表 */
      api.xpList(self.dialogList.id).then(res=>{
          self.tableChestData = res.content;
      })
    },
    submitDialog(){/**点击dialog提交按钮 */
      let self = this;
      let postData = {
        address:self.dialogList.address,
        phone:self.dialogList.phone,
        educationalLevel:self.dialogList.educationalLevel,
        maritalStatus:self.dialogList.maritalStatus,
        idCardValidDate: self.dialogList.idCardValidDate?self.timestampToTime(self.dialogList.idCardValidDate,'yy-mm-dd'):'',
        introducer:self.dialogList.introducer,
        idCardPhoto:self.dialogList.idCardPhoto,
        idCardPhoto1:self.dialogList.idCardPhoto1
      }
      self.$refs.dialogRefs.validate((valid) => {
        if(!valid){
          return;
        }
        if(self.dialog1.title === '添加') {
          api.addUpdataProviderInfo('insertProviderInfo',
            Object.assign(postData,{
              name:self.dialogList.name,
              idNo:self.dialogList.idNo,
              birthday: self.dialogList.birthday?self.timestampToTime(self.dialogList.birthday,'yy-mm-dd'):'',
              age:self.dialogList.age,
              sex:self.dialogList.sex,
              idNoAddress:self.dialogList.idNoAddress
            })
          ).then(res=>{
            self.$message.success('浆员添加成功！')
            self.dialog1.isShow = false;
            self.getData();
          })
        }else{
          let postData = {
            id:self.dialogList.id,
            phone:self.dialogList.phone,
            idCardScanDate:self.timestampToTime(self.dialogList.idCardScanDate,'yyyy-mm-dd hh:mm:ss'),
            educationalLevel:self.dialogList.educationalLevel,
            maritalStatus:self.dialogList.maritalStatus,
            certificateRegisterName:self.dialogList.certificateRegisterName,
            certificateRegisterId:localStorage.getItem("userId"),
            address:self.dialogList.address,
          };
          api.addUpdataProviderInfo('updateProviderInfo', Object.assign(postData,{
            id:self.dialogList.id,
            phone:self.dialogList.phone,
            idCardScanDate:self.timestampToTime(self.dialogList.idCardScanDate,'yyyy-mm-dd hh:mm:ss'),
            educationalLevel:self.dialogList.educationalLevel,
            maritalStatus:self.dialogList.maritalStatus,
            certificateRegisterName:self.dialogList.certificateRegisterName,
            certificateRegisterId:localStorage.getItem("userId"),
            address:self.dialogList.address,
          })).then(res=>{
            self.$message.success('浆员信息编辑成功！')
            self.dialog1.isShow = false;
            self.getData();
          })
        }
      })   
    },
    getchemicalList(){/**化检信息列表 */
      let self = this;
      self.chemicalList=[];
      api.getchemicalList(self.dialogList.id).then(res=>{
        self.chemicalList.push(res.content);
      })
    },
    getFingerPrintList(){/**化检信息列表 */
      let self = this;
      api.getFingerPrintList(self.dialogList.id).then(res=>{
        self.fingerPrintList=res.content;
      })
    },
    beforeAvatarUpload(file){/**身份证上传前 */
      // let self  = this;
      const isJPG = file.type.substr(0,5) === 'image';
      const isLt10M = file.size / 1024 / 1024 < 10;
      // self.idCardPhotoType = 1;
      // self.idCardPhotoUrl = api.idImgUpload(self.idCardPhotoNo,self.idCardPhotoType);
      if (!isJPG) {
          this.$message.error('只能上传图片!');
      }
      if (!isLt10M) {
          this.$message.error('上传头像图片大小不能超过 10MB!');
      }
      return isJPG && isLt10M
    },
    // beforeAvatarUpload1(file){
    //   let self  = this;
    //   const isJPG = file.type.substr(0,5) === 'image';
    //   const isLt10M = file.size / 1024 / 1024 < 10;
    //   self.idCardPhotoType = 2;
    //   // self.idCardPhotoUrl = api.idImgUpload(self.idCardPhotoNo,self.idCardPhotoType);
    //   debugger;
    //   if (!isJPG) {
    //       this.$message.error('只能上传图片!');
    //   }
    //   if (!isLt10M) {
    //       this.$message.error('上传头像图片大小不能超过 10MB!');
    //   }
    //   return isJPG && isLt10M      
    // },
    handleAvatarSuccess(response, file, fileList){
       this.dialogList.idCardPhoto = response.content;
    },
    handleAvatarSuccess1(response, file, fileList){
       this.dialogList.idCardPhoto1 = response.content;
    },
    handleAvatarChestSuccess(response, file, fileList){
      // this.dialogChestList.photo = response;
      this.imgurlpath = response;
      api.queryImgBase64Data({sfxPath:response}).then(res =>{
          this.dialogChestList.photo = res.content;
      });
      //获取img base64的数据
    },
    dialog2Show(type,row){
      let self = this;
      self.dialog2.isShow = true;
      if(type==='chemical'){
        self.dialog2.title="化检详细信息";
        self.chemicalInfo = row;
      }
    },
    submitChestDialog(){
      let self = this;
      debugger;
      switch (self.dialogForUp.type) {
        case 'blood':self.submitBlood();   break;
        case 'ct':self.submitCt();   break;
        case 'mt':self.submitMt();   break;
        case 'ots':self.submitOts();   break;
        case 'history':self.submitHistory();   break;
        default:
          break;
      }
    },
    submitBlood(){
      let self = this;
      api.insertAndUpdateBlood(self.dialogForUp).then(res=>{
          self.dialogForUp.isShow = false;
          self.$message("保存成功!");
          self.queryOtherChecks(1);

      });
    },
    submitCt(){
       let self = this;
      api.insertAndUpdateCt(self.dialogForUp).then(res=>{
          self.dialogForUp.isShow = false;
          self.$message("保存成功!");
          self.queryOtherChecks(2);
      })
    },
    submitMt(){
       let self = this;
      api.insertAndUpdateMt(self.dialogForUp).then(res=>{
          self.dialogForUp.isShow = false;
          self.$message("保存成功!");
          self.queryOtherChecks(3);
      })
    },
    submitOts(){
       let self = this;
      api.insertAndUpdateOts(self.dialogForUp).then(res=>{
          self.dialogForUp.isShow = false;
          self.$message("保存成功!");
          self.queryOtherChecks(4);
      })
    },
    submitHistory(){
       let self = this;
      api.insertAndUpdateHistory(self.dialogForUp).then(res=>{
          self.dialogForUp.isShow = false;
          self.$message("保存成功!");
          self.queryOtherChecks(5);
      })
    },
    submitChestDialog1(){/**提交病例信息 */
      let self = this;
      // dialogForUp.type==='ots'
      let data = {
        crearor: self.dialogChestList.crearor,
        crearorName:self.dialogChestList.crearorName,
        createDate: self.dialogChestList.createDate,
        doctor: self.dialogChestList.doctor,
        hospital:self.dialogChestList.hospital,
        id: self.dialogChestList.id,
        providerNo: self.dialogList.id,
        photo: self.imgurlpath,
        remark: self.dialogChestList.remark,
        result: self.dialogChestList.result,
        validDate: self.timestampToTime(self.dialogChestList.validDate,'yy-mm-dd hh:mm:ss') 
      }
      self.$refs.chestForm.validate((valid) => {
        if(!valid){
          return;
        }
        let type= self.dialog3.title==="新增"?'insert':'update';
        api.insertUpdataXp(type,data).then(res=>{
          self.$message.success(`${type==='insert'?'新增':'编辑'}成功`);
          self.dialog3.isShow=false;
          self.getXpList();
        })
      })
    },
    //打开上传dialog弹窗
    insertUpdateCheck(type,row){
      let self = this;
      self.copyRowDataToFormData(type,row);
      switch (type) {
        case 'blood': self.dialogForUp.isShow = true;self.dialogForUp.type=type;self.dialogForUp.actionUrl=api.idTypeImgUpload(row.id,1);self.queryOtherChecksDetail(row.id,1); break;  //血源循环检测
        case 'ct': self.dialogForUp.isShow = true;self.dialogForUp.type=type;self.dialogForUp.actionUrl=api.idTypeImgUpload(row.id,2);self.queryOtherChecksDetail(row.id,2); break;     //CT检测
        case 'mt': self.dialogForUp.isShow = true;self.dialogForUp.type=type;self.dialogForUp.actionUrl=api.idTypeImgUpload(row.id,3);self.queryOtherChecksDetail(row.id,3); break;     //MT
        case 'ots': self.dialogForUp.isShow = true;self.dialogForUp.type=type;self.dialogForUp.actionUrl=api.idTypeImgUpload(row.id,4);self.queryOtherChecksDetail(row.id,4); break;    //其它     
        case 'history': self.dialogForUp.isShow = true;self.dialogForUp.type=type;self.dialogForUp.actionUrl=api.idTypeImgUpload(row.id,5);self.queryOtherChecksDetail(row.id,5); break;    //历史病例    
        default: break;
      }
    },
    //数据回显
    copyRowDataToFormData(type,row){
      let self = this;
          self.dialogForUp.id = row.id;
          self.dialogForUp.checkDate = row.checkDate;
          self.dialogForUp.uploadDate = row.uploadDate;
          self.dialogForUp.uploadUser = row.uploadUser;
          self.dialogForUp.uploadUserName = row.uploadUserName;
          self.dialogForUp.providerIdCard = row.providerIdCard;
      switch (type) {
        case 'blood':
          self.dialogForUp.bloodId = row.id;
          self.dialogForUp.wbc = row.wbc;
          self.dialogForUp.platelet = row.platelet;
          self.dialogForUp.hct = row.hct;
          self.dialogForUp.lp = row.lp;
          self.dialogForUp.sod = row.sod;
          self.dialogForUp.mda = row.mda;
          self.dialogForUp.ldl = row.ldl;
          self.dialogForUp.cholesterol = row.cholesterol;
           break;
        case 'ct':
          self.dialogForUp.ctId = row.id;
          
           break;
        case 'mt': 
          self.dialogForUp.mtId = row.id;
       
           break;
        case 'ots':
          self.dialogForUp.otsId = row.id;
           break;
        case 'history':
          self.dialogForUp.historyId = row.id;
          self.dialogForUp.checkUnit = row.checkUnit;
          self.dialogForUp.checkRemark = row.checkRemark;
          break;
      
        default:
          break;
      }

    },
    //获取病例数据
    queryOtherChecksDetail(id,type){
      let self = this;
      self.fileList=[];
      api.queryOtherChecksDetail(id,type).then(res=>{
          self.$refs.uploadImageBox.clearFiles();
          let images = res.content[0].images;       
          images.forEach(element => {
            self.fileList.push({name:Math.random(1000),url:element});
          });
      });
    },
  }
}
</script>
<style lang="stylus" scoped>
.zqty_bodys {
  background: white;
  box-shadow: 0px 0px 13px rgba(0, 0, 0, 0.3);
}
.photoImg{
  height 275px

}

.xpPhoto{
  height 1000px
  width 95%
}
.avatar-uploader-icon:before{
    margin-top 166px

  }
 .showDataLi{
    width:400px;
    height:200px;
    border:1px solid rgba(0,0,0,0.1);
    background: white;
    box-shadow : 0px 0px 8px rgba(216,216,216,0.9);
    float:left;
    margin-left: 10px;
    margin-top:10px;
    border-radius: 10px;
    overflow-y:hidden;
    cursor:pointer;
  }
  .showDataFootLeft,.showDataFootRight{
    width:100%;
    height:51px;
    color:black;
    float:left;
    margin-left:0px;
  }
  .showDataFootLeft:hover,.showDataFootRight:hover{
      color: $theme-color;
      background:rgba(216,216,216,0.4);
      font-weight:bolder;
  }
  .showDataLi:hover{
    border:1px solid rgba(0,0,0,0.2);
    box-shadow : 0px 0px 13px rgba(0,0,0,0.3);
  }
  
  .showDataTop{
    width:398px;
    height:148px;
  }
  .showDataFoot{
    border-top:1px solid rgba(216,216,216,0.5);
    width:100%;
    height:51px;
    text-align:center;
    line-height:50px;
    background:#F9FAFC;
    font-size:14px;
    color:rgba(0,0,0,0.5);
  }

  .showDataFoot:hover{
      color: $theme-color;
      background:rgba(216,216,216,0.4);
      font-weight:bolder;
  }

  .showDataTopLeft{
    border:0px solid blue;
    width:80px;
    height:82px;
    float:left;
    margin-left:10px;
    margin-top:20px;
    border-radius: 42px;
    overflow-y:hidden;
  }
  .showDataImg{
    width:100%;
  }
  .showDataTopCenter{
    width:210px;
    height:100px;
    float:left;
    margin-left:10px;
    margin-top:20px;
  }
  .showDataTopRight{
    width:80px;
    height:148px;
    float:left;
    text-align:center;
  }
  .divTop{
    width:100%;
  }
  .divfooter{
    width:60%;
    height:50px;
    margin-top:30px;
  }
</style>


